/* =========================================
   استایل تم Teal Dark پیشرفته
   ========================================= */
:root {
    --bg-dark: #022c2b;
    --card-bg: rgba(4, 47, 46, 0.9);
    --primary: #14b8a6;
    --primary-hover: #0f766e;
    --accent: #2dd4bf;
    --text-main: #ccfbf1;
    --text-muted: #99f6e4;
    --border: #115e59;
    --danger: #ef4444;
    --input-bg: rgba(0, 0, 0, 0.3);
}

* {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
    outline: none;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(20, 184, 166, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(45, 212, 191, 0.05) 0%, transparent 40%);
    direction: rtl;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-main);
    transition: direction 0.3s ease;
}

.container {
    background-color: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 35px;
    border-radius: 24px;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(20, 184, 166, 0.1);
    width: 100%;
    max-width: 800px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

/* دکمه تغییر زبان */
.lang-switch {
   
   
    left: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 10;
    width: 100px;
}

html[dir="rtl"] .lang-switch {
    left: auto;
    right: 20px;
}

.lang-switch:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.4);
}

h2 {
    font-size: 2rem;
    margin: 0 0 30px 0;
    color: var(--accent);
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 0 20px rgba(45, 212, 191, 0.2);
}

/* --- تب‌ها --- */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.tab-content.active {
    display: block;
}

/* --- فرم‌ها --- */
.form-group {
    margin-bottom: 20px;
    width: 100%;
    text-align: right;
}

label {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    background-color: var(--input-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    direction: ltr;
    text-align: left;
}

input:focus {
    border-color: var(--accent);
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

input::placeholder {
    color: rgba(153, 246, 228, 0.3);
}

/* --- دکمه‌ها --- */
button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
    margin-top: 10px;
    font-family: inherit;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.5);
    filter: brightness(1.1);
}

button:active {
    transform: translateY(1px);
}

.add-btn {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.add-btn:hover {
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5);
}

/* --- جدول --- */
.table-wrapper {
    margin: 25px 0;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background-color: rgba(20, 184, 166, 0.15);
    color: var(--accent);
    padding: 12px;
    text-align: center;
    position: sticky;
    top: 0;
    backdrop-filter: blur(5px);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
}

td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.delete-btn {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid var(--danger);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    width: auto;
    margin: 0;
    box-shadow: none;
}

.delete-btn:hover {
    background-color: var(--danger);
    color: white;
    transform: none;
}

/* --- باکس نتیجه --- */
.result-box {
    margin-top: 25px;
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    text-align: center;
    background-color: rgba(20, 184, 166, 0.1);
    border: 1px solid var(--primary);
    border-radius: 12px;
    animation: fadeIn 0.5s ease-in-out;
    display: none;
}

/* --- مراحل حل (Steps) --- */
.steps-box {
    margin-top: 20px;
    width: 100%;
    padding: 20px;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    border-radius: 12px;
    display: none;
    direction: ltr;
    text-align: left;
}

.step-item {
    margin-bottom: 15px;
    border-bottom: 1px dashed #334155;
    padding-bottom: 10px;
}

.step-item:last-child {
    border-bottom: none;
}

.step-title {
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
}

/* MathML Styling */
math {
    font-family: 'Times New Roman', serif;
    font-size: 1.15em;
    direction: ltr;
    display: block;
    margin: 8px 0;
    color: #e2e8f0;
}

mi, mn, mo {
    color: #f0fdfa;
}

mtext {
    color: #cbd5e1;
}

/* --- انیمیشن‌ها --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- اسکرول‌بار --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
    border: 2px solid #0f172a;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

html {
    scroll-behavior: smooth;
}